/* ScanBeyond Scam Triage Assistant — chat widget */
.sb-chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999998;
  height: 64px;
  min-width: 64px;
  padding: 0 24px 0 20px;
  border-radius: 32px;
  border: 1px solid rgba(255,255,255,0.14);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(94,92,230,0.55) 0%, rgba(94,92,230,0) 55%),
    linear-gradient(135deg, #0a84ff 0%, #0066cc 55%, #0a4fb3 100%);
  color: #fff;
  font: 600 14px/1 -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, sans-serif;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow:
    0 18px 40px rgba(10, 132, 255, 0.40),
    0 6px 14px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.22s cubic-bezier(.2,.8,.2,1),
              box-shadow 0.22s ease,
              background-color 0.22s ease;
  -webkit-tap-highlight-color: transparent;
  isolation: isolate;
  overflow: visible;
  animation: sb-fab-enter 0.55s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes sb-fab-enter {
  from { transform: translateY(14px) scale(0.92); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.sb-chat-fab:hover {
  transform: translateY(-2px);
  box-shadow:
    0 24px 56px rgba(10, 132, 255, 0.55),
    0 8px 18px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.sb-chat-fab:active { transform: translateY(0) scale(0.97); }
.sb-chat-fab:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(10, 132, 255, 0.35),
    0 18px 40px rgba(10, 132, 255, 0.40),
    0 6px 14px rgba(0, 0, 0, 0.22);
}
.sb-chat-fab[hidden] { display: none; }

.sb-chat-fab-icon {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 17px;
  background: rgba(255,255,255,0.16);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
}
.sb-chat-fab-icon svg { width: 20px; height: 20px; }

.sb-chat-fab-label {
  position: relative;
  z-index: 2;
  white-space: nowrap;
}

.sb-chat-fab-dot {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 10px;
  height: 10px;
  border-radius: 5px;
  background: #30d158;
  box-shadow: 0 0 0 2px rgba(20,20,22,0.85), 0 0 8px rgba(48, 209, 88, 0.7);
  z-index: 3;
}

.sb-chat-fab-glow {
  position: absolute;
  inset: -22px;
  border-radius: 50px;
  background: radial-gradient(closest-side, rgba(10,132,255,0.45), rgba(10,132,255,0) 70%);
  filter: blur(18px);
  opacity: 0.85;
  z-index: 0;
  pointer-events: none;
  animation: sb-fab-glow 4s ease-in-out infinite;
}
@keyframes sb-fab-glow {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%      { opacity: 0.95; transform: scale(1.06); }
}

.sb-chat-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 32px;
  border: 1.5px solid rgba(255,255,255,0.35);
  animation: sb-pulse 2.6s ease-out infinite;
  pointer-events: none;
  z-index: 1;
}
@keyframes sb-pulse {
  0%   { transform: scale(0.92); opacity: 0.85; }
  100% { transform: scale(1.18); opacity: 0; }
}

.sb-chat-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  width: min(420px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 48px));
  background: rgba(20, 20, 22, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-radius: 22px;
  box-shadow: 0 28px 90px rgba(0,0,0,0.5), 0 2px 12px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  color: #f5f5f7;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, sans-serif;
  transform-origin: bottom right;
  animation: sb-pop-in 0.28s cubic-bezier(.2,.8,.2,1);
}
@keyframes sb-pop-in {
  from { transform: scale(0.94) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.sb-chat-panel[hidden] { display: none; }

.sb-chat-header {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: linear-gradient(180deg, rgba(10,132,255,0.16), rgba(10,132,255,0));
}
.sb-chat-avatar {
  width: 36px; height: 36px; border-radius: 18px;
  background: linear-gradient(135deg, #0a84ff, #5e5ce6);
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.sb-chat-avatar svg { width: 20px; height: 20px; }
.sb-chat-title { flex: 1; min-width: 0; }
.sb-chat-title h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.sb-chat-title p { margin: 1px 0 0; font-size: 11px; color: rgba(245,245,247,0.6); display: flex; align-items: center; gap: 5px; }
.sb-chat-title p::before {
  content: ''; width: 6px; height: 6px; border-radius: 3px;
  background: #30d158;
  box-shadow: 0 0 6px rgba(48, 209, 88, 0.7);
}
.sb-chat-close {
  background: rgba(255,255,255,0.08);
  border: none; color: #fff;
  width: 30px; height: 30px; border-radius: 15px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease;
}
.sb-chat-close:hover { background: rgba(255,255,255,0.16); }
.sb-chat-close svg { width: 14px; height: 14px; }

.sb-chat-action {
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.07);
  color: rgba(245,245,247,0.92);
  border-radius: 10px;
  height: 30px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.sb-chat-action:hover {
  background: rgba(10,132,255,0.18);
  border-color: rgba(10,132,255,0.42);
  transform: translateY(-1px);
}

.sb-chat-action:active {
  transform: translateY(0);
}

/* Overflow "More" menu in chat header */
.sb-chat-menu-wrap {
  position: relative;
  display: inline-flex;
}
.sb-chat-more {
  width: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sb-chat-more svg {
  width: 16px;
  height: 16px;
}
.sb-chat-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 240px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(2, 6, 23, 0.55);
  padding: 6px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sb-chat-menu[hidden] { display: none; }
.sb-chat-menu-item {
  appearance: none;
  background: transparent;
  border: 0;
  color: #e2e8f0;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font: inherit;
  transition: background 0.15s ease;
}
.sb-chat-menu-item:hover,
.sb-chat-menu-item:focus-visible {
  background: rgba(56, 189, 248, 0.12);
  outline: none;
}
.sb-chat-menu-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #7dd3fc;
  margin-top: 1px;
}
.sb-chat-menu-icon svg {
  width: 18px;
  height: 18px;
}
.sb-chat-menu-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.sb-chat-menu-text strong {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
}
.sb-chat-menu-text small {
  font-size: 11px;
  color: rgba(226, 232, 240, 0.65);
  line-height: 1.3;
}

.sb-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
}
.sb-chat-body::-webkit-scrollbar { width: 6px; }
.sb-chat-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 3px; }

.sb-chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
  margin: 0;
  transform-origin: 50% 100%;
  animation: sb-msg-spring 360ms cubic-bezier(.16,.84,.34,1.08) both;
  transition: transform 140ms ease, box-shadow 180ms ease;
}
.sb-chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #0a84ff, #0066cc);
  color: #fff;
  border-bottom-right-radius: 8px;
}
.sb-chat-msg.assistant {
  align-self: flex-start;
  background: rgba(255,255,255,0.10);
  color: #f5f5f7;
  border-bottom-left-radius: 8px;
}

.sb-chat-msg.assistant a {
  color: #7cb7ff;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.sb-chat-msg.user:hover,
.sb-chat-msg.assistant:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(2,6,23,0.26);
}
.sb-chat-msg.system-error {
  align-self: center;
  background: rgba(255, 69, 58, 0.15);
  color: #ff6961;
  font-size: 12px;
  border-radius: 10px;
  padding: 8px 12px;
}

@keyframes sb-msg-spring {
  0% { opacity: 0; transform: translateY(10px) scale(0.97); }
  68% { opacity: 1; transform: translateY(-2px) scale(1.005); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.sb-chat-upsell {
  align-self: stretch;
  margin: 4px 0;
  padding: 18px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(10,132,255,0.18), rgba(94,92,230,0.18));
  border: 1px solid rgba(10,132,255,0.35);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.sb-chat-upsell-icon {
  width: 44px; height: 44px; border-radius: 22px;
  background: linear-gradient(135deg, #0a84ff, #5e5ce6);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 6px 18px rgba(10,132,255,0.4);
}
.sb-chat-upsell-icon svg { width: 22px; height: 22px; }
.sb-chat-upsell h4 {
  margin: 4px 0 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: #f5f5f7;
}
.sb-chat-upsell p {
  margin: 0; font-size: 13px; line-height: 1.45; color: rgba(245,245,247,0.75);
}
.sb-chat-upsell-actions {
  display: flex; gap: 8px; margin-top: 6px; width: 100%;
}
.sb-chat-upsell-btn {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #f5f5f7;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.sb-chat-upsell-btn:hover { background: rgba(255,255,255,0.12); }
.sb-chat-upsell-btn:active { transform: scale(0.97); }
.sb-chat-upsell-btn.primary {
  background: linear-gradient(135deg, #0a84ff, #0066cc);
  border-color: transparent;
  color: #fff;
}
.sb-chat-upsell-btn.primary:hover { filter: brightness(1.1); background: linear-gradient(135deg, #0a84ff, #0066cc); }

.sb-chat-tools {
  align-self: flex-start;
  font-size: 11px;
  color: rgba(245,245,247,0.55);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -4px 0 4px 4px;
}
.sb-chat-tools .tool {
  background: rgba(255,255,255,0.06);
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
}

.sb-chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.08);
  border-radius: 16px;
  border-bottom-left-radius: 6px;
}
.sb-chat-typing span {
  width: 6px; height: 6px;
  border-radius: 3px;
  background: rgba(245,245,247,0.5);
  animation: sb-bounce 1.2s infinite ease-in-out;
}
.sb-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.sb-chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes sb-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.sb-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 8px;
  margin-top: 0;
}

.sb-chat-branches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 8px;
}

.sb-chat-branch-chip {
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  color: rgba(245,245,247,0.9);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
  max-width: 180px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.sb-chat-branch-chip:hover {
  border-color: rgba(10,132,255,0.45);
  background: rgba(10,132,255,0.16);
  transform: translateY(-1px);
}

.sb-chat-panel.sb-chat-intro .sb-chat-body {
  flex: 0 0 auto;
  overflow: visible;
}

.sb-chat-panel.sb-chat-intro {
  height: auto;
  max-height: min(640px, calc(100vh - 48px));
}

.sb-chat-panel.sb-chat-intro .sb-chat-suggestions {
  margin-top: 8px;
}

@media (max-width: 820px) {
  .sb-chat-panel.sb-chat-intro {
    height: min(86dvh, 760px);
    max-height: calc(100dvh - 24px);
  }

  .sb-chat-panel.sb-chat-intro .sb-chat-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }
}

.sb-chat-chip {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #f5f5f7;
  padding: 6px 12px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  font-family: inherit;
}
.sb-chat-chip:hover { background: rgba(10,132,255,0.18); border-color: rgba(10,132,255,0.4); }
.sb-chat-chip:active { transform: scale(0.97); }

.sb-chat-input-wrap {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 12px 14px 14px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background:
    linear-gradient(180deg, rgba(13, 17, 24, 0.66), rgba(13, 17, 24, 0.86)),
    radial-gradient(140% 120% at 0% 0%, rgba(255,255,255,0.08), rgba(255,255,255,0));
  -webkit-backdrop-filter: saturate(170%) blur(14px);
  backdrop-filter: saturate(170%) blur(14px);
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}

.sb-chat-attachment-row {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 8px 14px 0;
  background: rgba(0,0,0,0.18);
}

.sb-chat-attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(10,132,255,0.32);
  background: rgba(10,132,255,0.14);
  color: rgba(245,245,247,0.92);
  font-size: 12px;
}

.sb-chat-attachment-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.sb-chat-attachment-remove {
  border: none;
  width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.14);
  color: #fff;
  cursor: pointer;
  padding: 0;
}

.sb-chat-attachment-remove:hover {
  background: rgba(255,255,255,0.26);
}

.sb-chat-attach {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  border: 1.5px solid rgba(130, 170, 255, 0.78);
  background: rgba(120, 165, 255, 0.14);
  color: #d9e8ff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), 0 4px 12px rgba(74, 128, 235, 0.22);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.sb-chat-attach:hover:not(:disabled) {
  background: rgba(120, 165, 255, 0.24);
  border-color: rgba(154, 191, 255, 0.96);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.34), 0 6px 14px rgba(74, 128, 235, 0.3);
}

.sb-chat-attach:active:not(:disabled) {
  transform: scale(0.97);
}

.sb-chat-attach:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sb-chat-attach svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.6;
}

.sb-chat-voice {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.14);
  background: radial-gradient(120% 120% at 30% 20%, rgba(82, 90, 105, 0.8), rgba(42, 47, 58, 0.94));
  color: #f2f5fa;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 6px 14px rgba(0,0,0,0.32);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.sb-chat-voice svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.35;
}

.sb-chat-voice:hover:not(:disabled) {
  background: radial-gradient(120% 120% at 30% 20%, rgba(96, 104, 120, 0.92), rgba(52, 57, 70, 0.98));
  border-color: rgba(255,255,255,0.2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.24), 0 8px 16px rgba(0,0,0,0.4);
}

.sb-chat-voice.recording {
  background: radial-gradient(130% 130% at 30% 20%, rgba(255,69,58,0.42), rgba(255,69,58,0.22));
  border-color: rgba(255,69,58,0.58);
  color: #ffb4ad;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 6px 16px rgba(255,69,58,0.32);
}

/* iOS-specific flatter control treatment (iMessage-like) */
.sb-chat-panel.sb-ios-mode .sb-chat-attach {
  border: 1.5px solid rgba(176, 208, 255, 0.95);
  background: rgba(147, 190, 255, 0.14);
  color: #dcecff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.24);
}

.sb-chat-panel.sb-ios-mode .sb-chat-attach:hover:not(:disabled) {
  background: rgba(147, 190, 255, 0.2);
  border-color: rgba(195, 221, 255, 0.98);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28);
}

.sb-chat-panel.sb-ios-mode .sb-chat-send {
  border: 1px solid rgba(162, 206, 255, 0.84);
  background: linear-gradient(180deg, rgba(72, 165, 255, 0.95), rgba(36, 130, 244, 0.95));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.32), 0 3px 10px rgba(22, 102, 214, 0.24);
}

.sb-chat-panel.sb-ios-mode .sb-chat-send:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.03);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.36), 0 4px 11px rgba(22, 102, 214, 0.28);
  filter: none;
}

/* Android-specific Material-style control treatment */
.sb-chat-fab.sb-android-mode {
  border-radius: 22px;
  border-color: rgba(255,255,255,0.08);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(129, 120, 255, 0.35) 0%, rgba(129,120,255,0) 55%),
    linear-gradient(135deg, #3f51b5 0%, #3050c8 55%, #2541ad 100%);
  box-shadow: 0 14px 30px rgba(39, 70, 187, 0.35), 0 4px 10px rgba(0,0,0,0.22);
}

.sb-chat-panel.sb-android-mode .sb-chat-attach {
  border: 1px solid rgba(185, 200, 255, 0.24);
  background: rgba(104, 128, 230, 0.24);
  color: #e8eeff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 2px 6px rgba(31, 54, 166, 0.22);
}

.sb-chat-panel.sb-android-mode .sb-chat-attach:hover:not(:disabled) {
  background: rgba(112, 136, 242, 0.32);
  border-color: rgba(198, 210, 255, 0.34);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.16), 0 4px 8px rgba(31, 54, 166, 0.3);
}

.sb-chat-panel.sb-android-mode .sb-chat-voice {
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(180deg, rgba(79, 86, 102, 0.92), rgba(56, 61, 73, 0.96));
  color: #f7f9ff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 4px 10px rgba(0,0,0,0.26);
}

.sb-chat-panel.sb-android-mode .sb-chat-voice:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(93, 101, 118, 0.94), rgba(66, 73, 87, 0.98));
  border-color: rgba(255,255,255,0.18);
}

.sb-chat-panel.sb-android-mode .sb-chat-send {
  border: 1px solid rgba(156, 185, 255, 0.42);
  background: linear-gradient(180deg, rgba(88, 145, 255, 0.94), rgba(58, 118, 237, 0.96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.24), 0 4px 10px rgba(22, 76, 201, 0.3);
}

.sb-chat-panel.sb-android-mode .sb-chat-send:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.03);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), 0 6px 12px rgba(22, 76, 201, 0.38);
}

.sb-chat-panel.sb-android-mode {
  font-family: Roboto, 'Noto Sans', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.sb-chat-panel.sb-android-mode .sb-chat-title h3 {
  letter-spacing: 0;
  font-weight: 600;
}

.sb-chat-panel.sb-android-mode .sb-chat-body {
  gap: 7px;
}

.sb-chat-panel.sb-android-mode .sb-chat-msg {
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.42;
}

.sb-chat-panel.sb-android-mode .sb-chat-input-wrap {
  gap: 9px;
  padding-top: 11px;
  padding-left: 12px;
  padding-right: 12px;
}

.sb-chat-panel.sb-android-mode .sb-chat-input {
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.38;
  letter-spacing: 0.01em;
  background: rgba(255,255,255,0.085);
  border-color: rgba(193, 208, 255, 0.22);
}

.sb-chat-panel.sb-android-mode .sb-chat-input:focus {
  background: rgba(255,255,255,0.11);
  border-color: rgba(146, 185, 255, 0.58);
}

.sb-chat-panel.sb-android-mode .sb-chat-chip {
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 7px 11px;
  background: rgba(113, 134, 220, 0.16);
  border-color: rgba(188, 205, 255, 0.24);
}

.sb-chat-panel.sb-android-mode .sb-chat-disclaimer {
  font-size: 10px;
  letter-spacing: 0.01em;
}

.sb-chat-voice:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.sb-chat-input {
  flex: 1;
  resize: none;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  color: #f5f5f7;
  padding: 10px 12px;
  height: 44px;
  min-height: 44px !important;
  font-size: 14px;
  line-height: 1.4;
  font-family: inherit;
  max-height: 120px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.sb-chat-input:focus { border-color: rgba(10,132,255,0.6); background: rgba(255,255,255,0.09); }
.sb-chat-input::placeholder { color: rgba(245,245,247,0.4); }

.sb-chat-send {
  width: 38px; height: 38px;
  border-radius: 19px;
  border: 1px solid rgba(138, 187, 255, 0.5);
  background:
    radial-gradient(120% 120% at 28% 20%, rgba(116, 184, 255, 0.92), rgba(42, 117, 234, 0.92));
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.34), 0 6px 16px rgba(20, 90, 210, 0.35);
  transition: transform 0.1s ease, opacity 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.sb-chat-send:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.04);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.42), 0 8px 18px rgba(20, 90, 210, 0.42);
  filter: saturate(1.08);
}
.sb-chat-send:active:not(:disabled) { transform: scale(0.96); }
.sb-chat-send:disabled { opacity: 0.4; cursor: not-allowed; }
.sb-chat-send svg { width: 17px; height: 17px; stroke-width: 2.6; }

.sb-chat-send:focus-visible,
.sb-chat-input:focus-visible,
.sb-chat-attach:focus-visible,
.sb-chat-voice:focus-visible,
.sb-chat-action:focus-visible,
.sb-chat-close:focus-visible,
.sb-chat-chip:focus-visible,
.sb-chat-branch-chip:focus-visible {
  outline: 2px solid rgba(10,132,255,0.72);
  outline-offset: 2px;
}

.sb-chat-disclaimer {
  font-size: 10px;
  color: rgba(245,245,247,0.4);
  text-align: center;
  padding: 4px 14px 0;
  margin: 0;
}

@media (max-width: 480px) {
  /* Native full-screen mobile experience — bottom-sheet style immersive panel */
  .sb-chat-panel {
    right: 0;
    bottom: 0;
    left: 0;
    top: auto;
    width: 100vw;
    max-width: none;
    height: min(96dvh, 100dvh);
    max-height: 100dvh;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -12px 40px rgba(0,0,0,0.4);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Keep full chat space on mobile even for intro state */
  .sb-chat-panel.sb-chat-intro {
    height: min(96dvh, 100dvh);
    max-height: 100dvh;
  }

  .sb-chat-panel.sb-chat-intro .sb-chat-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Compact header for native feel — minimize chrome */
  .sb-chat-header {
    padding: 12px 16px 10px;
    gap: 8px;
    background: linear-gradient(180deg, rgba(10,132,255,0.08), transparent);
  }

  .sb-chat-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }

  .sb-chat-avatar svg {
    width: 18px;
    height: 18px;
  }

  .sb-chat-title h3 {
    font-size: 15px;
    margin: 0;
  }

  .sb-chat-title p {
    display: none;
  }

  .sb-chat-action {
    font-size: 11px;
    height: 32px;
    padding: 0 10px;
  }

  .sb-chat-fab {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    right: 16px;
    height: 66px;
    min-width: 66px;
    width: 66px;
    padding: 0;
    border-radius: 33px;
    justify-content: center;
  }
  .sb-chat-fab-label { display: none; }
  .sb-chat-fab-icon { background: transparent; box-shadow: none; width: 34px; height: 34px; }
  .sb-chat-fab-icon svg { width: 26px; height: 26px; }
  .sb-chat-fab-dot { top: 6px; right: 6px; }

  .sb-chat-fab.sb-android-mode {
    border-radius: 24px;
    width: 64px;
    height: 64px;
    min-width: 64px;
  }

  /* Native momentum scrolling */
  .sb-chat-body {
    padding: 12px 14px 0;
    gap: 8px;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .sb-chat-body::-webkit-scrollbar {
    display: none;
  }

  .sb-chat-msg {
    font-size: 15px;
    line-height: 1.5;
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 16px;
  }

  .sb-chat-msg.user {
    word-break: break-word;
  }

  .sb-chat-msg.assistant {
    background: rgba(255,255,255,0.12);
    color: #ffffff;
  }

  .sb-chat-msg.system-error {
    font-size: 13px;
    padding: 8px 10px;
  }

  .sb-chat-input {
    font-size: 16px; /* prevents iOS zoom-in */
    line-height: 1.5;
    min-height: 52px !important;
    max-height: 42dvh;
    padding: 12px 14px;
    border-radius: 18px;
  }

  /* Sticky input with safe-area awareness */
  .sb-chat-input-wrap {
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    gap: 10px;
    background:
      linear-gradient(180deg, rgba(0,0,0,0.02) 0%, rgba(10, 14, 21, 0.72) 100%),
      radial-gradient(180% 120% at 50% 0%, rgba(255,255,255,0.08), rgba(255,255,255,0));
    border-top: 1px solid rgba(255,255,255,0.08);
    -webkit-backdrop-filter: saturate(170%) blur(12px);
    backdrop-filter: saturate(170%) blur(12px);
  }

  .sb-chat-attachment-row {
    padding: 8px 12px 0;
  }

  .sb-chat-send {
    width: 46px;
    height: 46px;
    border-radius: 23px;
    border: 1px solid rgba(154, 201, 255, 0.56);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.36), 0 8px 18px rgba(20, 90, 210, 0.42);
  }

  .sb-chat-send:active:not(:disabled) {
    transform: scale(0.93);
  }

  .sb-chat-send svg { width: 19px; height: 19px; stroke-width: 2.65; }

  .sb-chat-voice,
  .sb-chat-attach {
    width: 46px;
    height: 46px;
    border-radius: 23px;
  }

  .sb-chat-voice:active:not(:disabled),
  .sb-chat-attach:active:not(:disabled) {
    transform: scale(0.94);
  }

  /* Dismissible suggestions with native collapse */
  .sb-chat-chip {
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 18px;
    word-break: break-word;
    flex-shrink: 1;
  }

  .sb-chat-suggestions {
    gap: 6px;
    padding: 8px 12px 6px;
    flex-wrap: wrap;
    align-content: flex-start;
    max-height: none;
  }

  .sb-chat-suggestions.collapsed {
    display: none;
  }

  .sb-chat-branch-chip {
    max-width: 160px;
    font-size: 12px;
    padding: 6px 10px;
  }

  .sb-chat-disclaimer {
    font-size: 10px;
    padding: 4px 12px 0;
    color: rgba(245,245,247,0.35);
  }

  .sb-chat-menu {
    min-width: 240px;
  }
  .sb-chat-menu-text strong { font-size: 14px; }
  .sb-chat-menu-text small { font-size: 12px; }
}

/* Ultra-narrow / when keyboard might shrink viewport — preserve full-screen immersive */
@media (max-width: 380px) {
  .sb-chat-panel {
    right: 0;
    left: 0;
    width: 100vw;
    bottom: 0;
    height: min(96dvh, 100dvh);
    border-radius: 18px 18px 0 0;
  }

  .sb-chat-panel.sb-chat-intro {
    height: min(96dvh, 100dvh);
  }

  .sb-chat-header {
    padding: 10px 14px 8px;
  }

  .sb-chat-title h3 {
    font-size: 14px;
  }

  .sb-chat-input {
    min-height: 48px !important;
    padding: 10px 12px;
  }

  .sb-chat-send,
  .sb-chat-voice,
  .sb-chat-attach {
    width: 46px;
    height: 46px;
    border-radius: 23px;
  }

  .sb-chat-panel.sb-ios-mode .sb-chat-send {
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.34), 0 4px 10px rgba(22, 102, 214, 0.24);
  }

  .sb-chat-panel.sb-ios-mode .sb-chat-attach {
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.26);
  }

  .sb-chat-panel.sb-android-mode .sb-chat-send,
  .sb-chat-panel.sb-android-mode .sb-chat-voice,
  .sb-chat-panel.sb-android-mode .sb-chat-attach {
    border-radius: 20px;
  }

  .sb-chat-panel.sb-android-mode .sb-chat-msg {
    border-radius: 13px;
    font-size: 14px;
    line-height: 1.4;
  }

  .sb-chat-panel.sb-android-mode .sb-chat-input-wrap {
    padding-top: 9px;
    padding-left: 10px;
    padding-right: 10px;
    gap: 8px;
  }

  .sb-chat-panel.sb-android-mode .sb-chat-input {
    border-radius: 13px;
    font-size: 16px;
    line-height: 1.34;
    padding-top: 11px;
    padding-bottom: 11px;
  }

  .sb-chat-panel.sb-android-mode .sb-chat-chip {
    border-radius: 11px;
    font-size: 12px;
    padding: 6px 10px;
  }

  .sb-chat-chip {
    font-size: 12px;
    padding: 6px 10px;
  }
}

/* Light mode support (follows site theme toggle) */
:root[data-theme="light"] .sb-chat-fab {
  border-color: rgba(37, 99, 235, 0.2);
  color: #fff;
  box-shadow:
    0 16px 34px rgba(37, 99, 235, 0.28),
    0 4px 10px rgba(15, 23, 42, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

:root[data-theme="light"] .sb-chat-fab-dot {
  box-shadow: 0 0 0 2px rgba(246, 250, 255, 0.95), 0 0 8px rgba(48, 209, 88, 0.6);
}

:root[data-theme="light"] .sb-chat-panel {
  background: rgba(255, 255, 255, 0.93);
  color: #0f172a;
  border: 1px solid rgba(37, 99, 235, 0.16);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18), 0 2px 10px rgba(15, 23, 42, 0.1), inset 0 1px 0 rgba(255,255,255,0.75);
}

:root[data-theme="light"] .sb-chat-header {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.14), rgba(37, 99, 235, 0));
}

:root[data-theme="light"] .sb-chat-title h3 {
  color: #0f172a;
}

:root[data-theme="light"] .sb-chat-title p {
  color: rgba(15, 23, 42, 0.62);
}

:root[data-theme="light"] .sb-chat-close {
  background: rgba(15, 23, 42, 0.07);
  color: #0f172a;
}

:root[data-theme="light"] .sb-chat-close:hover {
  background: rgba(37, 99, 235, 0.12);
}

:root[data-theme="light"] .sb-chat-action {
  border-color: rgba(15, 23, 42, 0.14);
  background: rgba(15, 23, 42, 0.05);
  color: #1e293b;
}

:root[data-theme="light"] .sb-chat-action:hover {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.3);
}

:root[data-theme="light"] .sb-chat-menu {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.16);
}

:root[data-theme="light"] .sb-chat-menu-item {
  color: #1e293b;
}

:root[data-theme="light"] .sb-chat-menu-item:hover,
:root[data-theme="light"] .sb-chat-menu-item:focus-visible {
  background: rgba(37, 99, 235, 0.1);
}

:root[data-theme="light"] .sb-chat-menu-icon {
  color: #2563eb;
}

:root[data-theme="light"] .sb-chat-menu-text strong {
  color: #0f172a;
}

:root[data-theme="light"] .sb-chat-menu-text small {
  color: rgba(15, 23, 42, 0.58);
}

:root[data-theme="light"] .sb-chat-body {
  scrollbar-color: rgba(15,23,42,0.22) transparent;
}

:root[data-theme="light"] .sb-chat-body::-webkit-scrollbar-thumb {
  background: rgba(15,23,42,0.22);
}

:root[data-theme="light"] .sb-chat-msg.user {
  color: #fff;
}

:root[data-theme="light"] .sb-chat-msg.assistant {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

:root[data-theme="light"] .sb-chat-msg.assistant a {
  color: #1d4ed8;
}

:root[data-theme="light"] .sb-chat-msg.system-error {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
}

:root[data-theme="light"] .sb-chat-tools {
  color: rgba(15, 23, 42, 0.52);
}

:root[data-theme="light"] .sb-chat-tools .tool {
  background: rgba(15,23,42,0.05);
  border-color: rgba(15,23,42,0.08);
}

:root[data-theme="light"] .sb-chat-typing {
  background: rgba(15,23,42,0.07);
}

:root[data-theme="light"] .sb-chat-typing span {
  background: rgba(15,23,42,0.4);
}

:root[data-theme="light"] .sb-chat-chip,
:root[data-theme="light"] .sb-chat-branch-chip {
  background: rgba(15,23,42,0.05);
  border-color: rgba(15,23,42,0.14);
  color: #0f172a;
}

:root[data-theme="light"] .sb-chat-chip:hover,
:root[data-theme="light"] .sb-chat-branch-chip:hover {
  background: rgba(37,99,235,0.12);
  border-color: rgba(37,99,235,0.3);
}

:root[data-theme="light"] .sb-chat-disclaimer {
  color: rgba(15, 23, 42, 0.48);
}

:root[data-theme="light"] .sb-chat-input-wrap {
  border-top: 1px solid rgba(15,23,42,0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(247, 250, 255, 0.9)),
    radial-gradient(140% 120% at 0% 0%, rgba(37,99,235,0.08), rgba(255,255,255,0));
}

:root[data-theme="light"] .sb-chat-attachment-row {
  border-top: 1px solid rgba(15,23,42,0.08);
  background: rgba(15,23,42,0.03);
}

:root[data-theme="light"] .sb-chat-attachment-pill {
  border-color: rgba(37,99,235,0.28);
  background: rgba(37,99,235,0.1);
  color: #1e293b;
}

:root[data-theme="light"] .sb-chat-attachment-remove {
  background: rgba(15,23,42,0.12);
  color: #0f172a;
}

:root[data-theme="light"] .sb-chat-attachment-remove:hover {
  background: rgba(15,23,42,0.2);
}

:root[data-theme="light"] .sb-chat-input {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.14);
  color: #0f172a;
}

:root[data-theme="light"] .sb-chat-input:focus {
  border-color: rgba(37,99,235,0.55);
  background: rgba(37,99,235,0.08);
}

:root[data-theme="light"] .sb-chat-input::placeholder {
  color: rgba(15,23,42,0.42);
}

:root[data-theme="light"] .sb-chat-voice {
  border-color: rgba(15,23,42,0.14);
  background: radial-gradient(120% 120% at 30% 20%, rgba(240, 244, 252, 0.98), rgba(223, 230, 243, 0.98));
  color: #1e293b;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 4px 10px rgba(15,23,42,0.14);
}

:root[data-theme="light"] .sb-chat-voice:hover:not(:disabled) {
  border-color: rgba(37,99,235,0.28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 6px 12px rgba(15,23,42,0.18);
}

:root[data-theme="light"] .sb-chat-attach {
  border-color: rgba(37,99,235,0.34);
  background: rgba(37,99,235,0.1);
  color: #1d4ed8;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 4px 10px rgba(37,99,235,0.15);
}

:root[data-theme="light"] .sb-chat-attach:hover:not(:disabled) {
  background: rgba(37,99,235,0.16);
  border-color: rgba(37,99,235,0.5);
}

:root[data-theme="light"] .sb-chat-panel.sb-android-mode .sb-chat-input {
  background: rgba(15,23,42,0.05);
  border-color: rgba(37,99,235,0.2);
}

:root[data-theme="light"] .sb-chat-panel.sb-android-mode .sb-chat-input:focus {
  background: rgba(37,99,235,0.1);
  border-color: rgba(37,99,235,0.46);
}

@media (prefers-reduced-motion: reduce) {
  .sb-chat-panel,
  .sb-chat-fab,
  .sb-chat-action,
  .sb-chat-msg,
  .sb-chat-chip,
  .sb-chat-branch-chip,
  .sb-chat-send,
  .sb-chat-voice,
  .sb-chat-attach {
    animation: none !important;
    transition: none !important;
  }
}

@media (prefers-color-scheme: light) {
  /* keep dark — looks better with brand */
}
