#lbw-ai-chat-root {
  position: relative;
  z-index: 999999;
  font-family: Arial, Helvetica, sans-serif;
}

#lbw-ai-chat-root *,
#lbw-ai-chat-root *::before,
#lbw-ai-chat-root *::after {
  box-sizing: border-box;
}

.lbw-ai-launcher-wrap {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 999999;
}

.lbw-ai-launcher {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: #f58220;
  color: #ffffff;
  padding: 11px 20px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(24, 24, 24, 0.22);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.lbw-ai-launcher__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
}

.lbw-ai-shell {
  position: fixed;
  right: 16px;
  bottom: 72px;
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 96px);
  z-index: 999998;
  color: #111111;
}

.lbw-ai-card {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(245, 130, 32, 0.24);
  box-shadow: 0 18px 46px rgba(25, 25, 25, 0.2);
  background: #fbf7f3;
  max-height: inherit;
}

.lbw-ai-panel {
  display: flex;
  min-height: 530px;
  height: min(700px, calc(100vh - 96px));
  max-height: inherit;
  background: linear-gradient(180deg, rgba(253, 248, 243, 0.98) 0%, rgba(255, 255, 255, 0.98) 100%);
}

.lbw-ai-sidebar {
  width: 220px;
  border-right: 1px solid rgba(17, 17, 17, 0.1);
  padding: 12px;
  background: rgba(255, 255, 255, 0.52);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.lbw-ai-sidebar-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lbw-ai-sidebar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.lbw-ai-sidebar-title {
  font-size: 13px;
  font-weight: 700;
  color: #111111;
}

.lbw-ai-archives {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-height: 0;
}

.lbw-ai-archive-empty {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.45;
}

.lbw-ai-archive-item {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(17, 17, 17, 0.12);
  background: #ffffff;
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
}

.lbw-ai-archive-title {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #111111;
  line-height: 1.4;
}

.lbw-ai-archive-meta {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: #6b7280;
}

.lbw-ai-main {
  flex: 1;
  padding: 12px 14px 14px;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.lbw-ai-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0 12px;
  border-top: 5px solid #f58220;
}

.lbw-ai-title {
  font-size: 16px;
  font-weight: 700;
  color: #111111;
}

.lbw-ai-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: #111111;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}

.lbw-ai-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0 12px;
  border-top: 1px solid rgba(17, 17, 17, 0.1);
  border-bottom: 1px solid rgba(17, 17, 17, 0.1);
}

.lbw-ai-toolbar-left,
.lbw-ai-toolbar-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.lbw-ai-ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(245, 130, 32, 0.22);
  background: #ffffff;
  color: #111111;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.lbw-ai-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 12px;
  border: 0;
  text-decoration: none;
  background: #f58220;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(245, 130, 32, 0.2);
}

.lbw-ai-archive-item:hover,
.lbw-ai-archive-item:focus-visible,
.lbw-ai-ghost-btn:hover,
.lbw-ai-ghost-btn:focus-visible,
.lbw-ai-link-btn:hover,
.lbw-ai-link-btn:focus-visible,
.lbw-ai-send:hover,
.lbw-ai-send:focus-visible,
.lbw-ai-launcher:hover,
.lbw-ai-launcher:focus-visible {
  outline: none;
}

.lbw-ai-notice {
  margin-top: 10px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(186, 26, 26, 0.18);
  background: #fff2f2;
  color: #8b2121;
  font-size: 12px;
}

.lbw-ai-messages {
  min-height: 0;
  max-height: none;
  flex: 1;
  overflow-y: auto;
  padding: 12px 1px 2px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lbw-ai-messages-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
}

.lbw-ai-empty-state {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 22px;
  border: 1px dashed rgba(17, 17, 17, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
}

.lbw-ai-empty-state-title {
  font-size: 16px;
  font-weight: 700;
  color: #111111;
}

.lbw-ai-empty-state-body {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.55;
  color: #6b7280;
  max-width: 420px;
}

.lbw-ai-message {
  max-width: 82%;
}

.lbw-ai-message-user {
  align-self: flex-end;
}

.lbw-ai-message-assistant {
  align-self: flex-start;
}

.lbw-ai-message-meta {
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #6b7280;
}

.lbw-ai-message-body {
  padding: 10px 12px;
  border-radius: 14px;
  background: #ffffff;
  color: #111111;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid rgba(17, 17, 17, 0.12);
  box-shadow: 0 8px 18px rgba(17, 17, 17, 0.05);
}

.lbw-ai-message-user .lbw-ai-message-body {
  background: #f58220;
  color: #ffffff;
  border-color: #f58220;
}

.lbw-ai-inline-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lbw-ai-inline-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 0;
  text-decoration: none;
  background: #f58220;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.lbw-ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.lbw-ai-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f58220;
  display: inline-block;
  animation: lbwAiPulse 1.2s infinite ease-in-out;
}

.lbw-ai-dot:nth-child(2) {
  animation-delay: 0.14s;
}

.lbw-ai-dot:nth-child(3) {
  animation-delay: 0.28s;
}

.lbw-ai-input-wrap {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(17, 17, 17, 0.1);
}

.lbw-ai-textarea {
  width: 100%;
  min-height: 140px;
  padding: 12px 13px;
  resize: none;
  border-radius: 16px;
  border: 1px solid #9aa4b2;
  background: #ffffff;
  font-size: 14px;
  line-height: 1.5;
  color: #111111;
}

.lbw-ai-textarea:focus {
  outline: none;
  border-color: #f58220;
  box-shadow: 0 0 0 3px rgba(245, 130, 32, 0.12);
}

.lbw-ai-footer {
  margin-top: 10px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.lbw-ai-disclaimer {
  font-size: 12px;
  line-height: 1.45;
  color: #5b6573;
  max-width: 460px;
}

.lbw-ai-send {
  appearance: none;
  border: 0;
  border-radius: 12px;
  background: #f58220;
  color: #ffffff;
  min-width: 84px;
  min-height: 40px;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(245, 130, 32, 0.2);
}

.lbw-ai-send[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
}

.lbw-ai-modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: rgba(17, 17, 17, 0.56);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.lbw-ai-modal {
  width: min(520px, 100%);
  border-radius: 18px;
  background: #ffffff;
  color: #111111;
  padding: 20px;
  border: 1px solid rgba(17, 17, 17, 0.14);
  box-shadow: 0 24px 48px rgba(17, 17, 17, 0.24);
}

.lbw-ai-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #111111;
}

.lbw-ai-modal-body {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.6;
  color: #374151;
}

.lbw-ai-check-row {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.5;
  color: #111111;
}

.lbw-ai-check-input {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  accent-color: #f58220;
}

.lbw-ai-modal-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

@keyframes lbwAiPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.88); }
  40% { opacity: 1; transform: scale(1); }
}

@media (max-width: 640px) {
  .lbw-ai-launcher-wrap {
    right: 10px;
    bottom: 10px;
  }

  .lbw-ai-shell {
    left: 10px;
    right: 10px;
    bottom: 62px;
    width: auto;
    max-height: calc(100vh - 72px);
  }

  .lbw-ai-card {
    border-radius: 16px;
  }

  .lbw-ai-panel {
    flex-direction: column;
    height: min(760px, calc(100vh - 72px));
  }

  .lbw-ai-sidebar {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid rgba(17, 17, 17, 0.1);
    max-height: 220px;
  }

  .lbw-ai-main {
    padding: 10px;
  }

  .lbw-ai-toolbar,
  .lbw-ai-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .lbw-ai-toolbar-left,
  .lbw-ai-toolbar-right {
    width: 100%;
  }

  .lbw-ai-ghost-btn,
  .lbw-ai-link-btn,
  .lbw-ai-send {
    width: 100%;
    justify-content: center;
  }

  .lbw-ai-modal-actions {
    flex-direction: column;
  }

  .lbw-ai-message {
    max-width: 100%;
  }
}
