.spac-chat-widget {
  --spac-chat-panel-width: min(480px, 100vw);
  --spac-chat-header-height: 58px;
  position: relative;
  z-index: 2147483000;
}

.spac-chat-launcher {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: #015477;
  color: #fff;
  box-shadow: 0 12px 32px rgba(0, 24, 38, 0.28);
  font: 600 14px/1 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.spac-chat-launcher:hover {
  background: #01688f;
  box-shadow: 0 15px 38px rgba(0, 24, 38, 0.34);
  transform: translateY(-1px);
}

.spac-chat-launcher:focus-visible,
.spac-chat-panel__action:focus-visible {
  outline: 3px solid rgba(88, 166, 255, 0.55);
  outline-offset: 2px;
}

.spac-chat-launcher img,
.spac-chat-panel__title img {
  display: block;
  flex: 0 0 auto;
  border-radius: 8px;
}

.spac-chat-panel {
  position: fixed;
  z-index: 3;
  top: var(--sr-header-height, 0px);
  right: 0;
  bottom: 0;
  width: var(--spac-chat-panel-width);
  max-width: 100%;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-color, #d9e0e5);
  background: #fff;
  box-shadow: -14px 0 42px rgba(0, 24, 38, 0.24);
  color: #17212b;
}

.spac-chat-panel[hidden],
.spac-chat-backdrop[hidden] {
  display: none !important;
}

.spac-chat-panel__header {
  display: none;
  height: var(--spac-chat-header-height);
  flex: 0 0 var(--spac-chat-header-height);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px 0 14px;
  border-bottom: 1px solid #d9e0e5;
  background: #fff;
}

.spac-chat-panel__title,
.spac-chat-panel__actions {
  display: flex;
  align-items: center;
}

.spac-chat-panel__title {
  gap: 9px;
  min-width: 0;
  font: 600 16px/1.2 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.spac-chat-panel__actions {
  gap: 4px;
}

.spac-chat-panel__action {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.spac-chat-panel__action:hover {
  background: #eef2f5;
  color: inherit;
  text-decoration: none;
}

.spac-chat-panel__body {
  flex: 1 1 auto;
  min-height: 0;
  background: #fff;
}

.spac-chat-panel iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}

.spac-chat-backdrop {
  position: fixed;
  z-index: 1;
  top: var(--sr-header-height, 0px);
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 18, 30, 0.5);
}

[data-theme="dark"] .spac-chat-panel,
[data-theme="dark"] .spac-chat-panel__header {
  border-color: #31414d;
  background: #151d23;
  color: #eef5f8;
}

[data-theme="dark"] .spac-chat-panel__action:hover {
  background: #26343e;
}

@media (min-width: 769px) {
  .spac-chat-backdrop {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .spac-chat-widget {
    --spac-chat-panel-width: 100vw;
  }

  .spac-chat-panel {
    width: 100vw;
    border-left: 0;
  }

  .spac-chat-launcher {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }
}


@media (prefers-reduced-motion: reduce) {
  .spac-chat-launcher {
    transition: none;
  }
}
