.maja-widget-root {
  --maja-widget-primary: #806592;
  --maja-widget-primary-hover: #6f587f;
  --maja-widget-primary-soft: rgba(128, 101, 146, 0.12);
  --maja-widget-bg: #ffffff;
  --maja-widget-bg-soft: #f4f8fc;
  --maja-widget-text: #1f2937;
  --maja-widget-muted: #64748b;
  --maja-widget-border: #dbe4ef;
  --maja-widget-shadow: 0 22px 44px rgba(15, 35, 65, 0.18);
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1080;
  font-family: inherit;
}

.maja-widget-root.maja-widget-root-embedded {
  position: relative;
  right: auto;
  bottom: auto;
  z-index: auto;
  width: 100%;
  max-width: none;
}

.maja-widget-root.maja-widget-root-embedded .maja-widget-fab {
  display: none;
}

.maja-widget-root.maja-widget-root-embedded .maja-widget-window {
  position: relative;
  right: auto;
  bottom: auto;
  width: 100%;
  height: min(70vh, 720px);
  min-height: 520px;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

.maja-widget-root.maja-widget-root-embedded .maja-widget-close {
  display: none;
}

.maja-widget-fab {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--maja-widget-primary) 0%, var(--maja-widget-primary-hover) 100%);
  color: #fff;
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(128, 101, 146, 0.34);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.maja-widget-fab:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(128, 101, 146, 0.38);
}

.maja-widget-fab:focus-visible {
  outline: 3px solid var(--maja-widget-primary-soft);
  outline-offset: 2px;
}

.maja-widget-fab-icon {
  width: 1.18rem;
  height: 1.18rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.maja-widget-fab-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.maja-widget-fab-label {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.maja-widget-fab-status {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #75f49a;
  box-shadow: 0 0 0 3px rgba(117, 244, 154, 0.2);
}

.maja-widget-window {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: min(420px, calc(100vw - 24px));
  height: min(640px, calc(100vh - 120px));
  background: var(--maja-widget-bg);
  border: 1px solid var(--maja-widget-border);
  border-radius: 22px;
  box-shadow: var(--maja-widget-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(14px) scale(0.98);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.maja-widget-root.is-open .maja-widget-window {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.maja-widget-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.95rem 1rem 0.9rem;
  border-bottom: 1px solid var(--maja-widget-border);
  background: var(--maja-widget-bg);
}

.maja-widget-header-meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.maja-widget-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--maja-widget-primary) 0%, var(--maja-widget-primary-hover) 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.94rem;
  font-weight: 700;
  flex: 0 0 auto;
}

.maja-widget-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--maja-widget-text);
  line-height: 1.2;
}

.maja-widget-subtitle {
  font-size: 0.79rem;
  color: var(--maja-widget-muted);
  line-height: 1.3;
}

.maja-widget-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.maja-widget-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.48rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--maja-widget-primary-hover);
  background: var(--maja-widget-primary-soft);
  border: 1px solid rgba(128, 101, 146, 0.26);
}

.maja-widget-status::before {
  content: '';
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: var(--maja-widget-primary);
}

.maja-widget-close {
  border: 0;
  background: #eef3f9;
  color: #334155;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.maja-widget-close:hover {
  background: #e3ebf5;
}

.maja-widget-close:focus-visible {
  outline: 3px solid var(--maja-widget-primary-soft);
  outline-offset: 2px;
}

.maja-widget-body {
  flex: 1 1 auto;
  overflow: hidden;
  background: linear-gradient(180deg, #f8fbff 0%, #f2f6fb 100%);
  display: flex;
  flex-direction: column;
}

.maja-widget-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.9rem 0.9rem 0.65rem;
}

.maja-widget-message {
  display: flex;
  margin-bottom: 0.7rem;
}

.maja-widget-message-user {
  justify-content: flex-end;
}

.maja-widget-message-bot,
.maja-widget-message-typing {
  justify-content: flex-start;
}

.maja-widget-message-bot {
  flex-direction: column;
  align-items: flex-start;
}

.maja-widget-message-bubble {
  max-width: 82%;
  border-radius: 1rem;
  padding: 0.66rem 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.92rem;
  line-height: 1.42;
}

.maja-widget-message-user .maja-widget-message-bubble {
  color: #fff;
  background: var(--maja-widget-primary);
  border-bottom-right-radius: 0.45rem;
}

.maja-widget-message-bot .maja-widget-message-bubble,
.maja-widget-message-typing .maja-widget-message-bubble {
  color: var(--maja-widget-text);
  background: var(--maja-widget-bg);
  border: 1px solid var(--maja-widget-border);
  border-bottom-left-radius: 0.45rem;
}

.maja-widget-message-time {
  margin-top: 0.3rem;
  font-size: 0.68rem;
  color: var(--maja-widget-muted);
}

.maja-widget-debug-json {
  margin-top: 0.45rem;
  background: #f2f4f7;
  border: 1px solid #d7dde7;
  border-radius: 10px;
  padding: 0.35rem 0.45rem;
  max-width: 92%;
}

.maja-widget-debug-json summary {
  font-size: 0.73rem;
  color: #4b5563;
  cursor: pointer;
}

.maja-widget-debug-json pre {
  margin: 0.35rem 0 0;
  max-height: 280px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.maja-widget-resolver-assistant {
  margin-top: 10px;
  border: 1px solid rgba(13, 110, 253, 0.2);
  background: rgba(13, 110, 253, 0.04);
  border-radius: 10px;
  padding: 8px 10px;
}

.maja-widget-resolver-assistant summary {
  cursor: pointer;
  font-weight: 600;
}

.maja-widget-resolver-assistant-body {
  margin-top: 8px;
  font-size: 12px;
}

.maja-widget-debug-line {
  margin-bottom: 3px;
}

.maja-widget-resolver-assistant pre {
  max-height: 220px;
  overflow: auto;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 8px;
  margin-top: 6px;
}

.maja-widget-appointment-panel {
  margin-top: 0.5rem;
  max-width: 92%;
}

.maja-widget-appointment-cta {
  border: 1px solid rgba(128, 101, 146, 0.35);
  background: #fff;
  color: var(--maja-widget-primary-hover);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  cursor: pointer;
}

.maja-widget-appointment-cta:hover {
  background: var(--maja-widget-primary-soft);
}

.maja-widget-appointment-form {
  margin-top: 0.45rem;
  background: #ffffff;
  border: 1px solid var(--maja-widget-border);
  border-radius: 12px;
  padding: 0.55rem;
}

.maja-widget-appointment-group {
  margin-bottom: 0.45rem;
}

.maja-widget-appointment-group label {
  display: block;
  font-size: 0.72rem;
  color: #475569;
  margin-bottom: 0.2rem;
}

.maja-widget-appointment-input {
  width: 100%;
  border: 1px solid rgba(128, 101, 146, 0.28);
  border-radius: 8px;
  padding: 0.42rem 0.52rem;
  font-size: 0.84rem;
}

.maja-widget-appointment-input:focus {
  outline: 3px solid var(--maja-widget-primary-soft);
  border-color: var(--maja-widget-primary);
}

.maja-widget-appointment-textarea {
  resize: vertical;
  min-height: 72px;
  line-height: 1.35;
}

.maja-widget-appointment-error {
  font-size: 0.74rem;
  color: #9f1636;
  background: #fdecef;
  border: 1px solid #f5c2c7;
  border-radius: 8px;
  padding: 0.3rem 0.45rem;
  margin-bottom: 0.45rem;
}

.maja-widget-appointment-consent {
  font-size: 0.68rem;
  line-height: 1.35;
  color: #64748b;
  margin-bottom: 0.45rem;
}

.maja-widget-appointment-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}

.maja-widget-appointment-submit,
.maja-widget-appointment-cancel {
  border: 0;
  border-radius: 8px;
  font-size: 0.78rem;
  padding: 0.38rem 0.62rem;
  cursor: pointer;
}

.maja-widget-appointment-submit {
  background: var(--maja-widget-primary);
  color: #fff;
}

.maja-widget-appointment-submit:hover {
  background: var(--maja-widget-primary-hover);
}

.maja-widget-appointment-cancel {
  background: #eef2f7;
  color: #334155;
}

.maja-widget-message-bot .maja-widget-message-bubble p {
  margin: 0 0 8px;
}

.maja-widget-message-bot .maja-widget-message-bubble p:last-child {
  margin-bottom: 0;
}

.maja-widget-message-bot .maja-widget-message-bubble ul,
.maja-widget-message-bot .maja-widget-message-bubble ol {
  margin: 8px 0;
  padding-left: 20px;
}

.maja-widget-message-bot .maja-widget-message-bubble strong {
  font-weight: 700;
}

.maja-widget-message-bot .maja-widget-message-bubble a {
  color: var(--maja-widget-primary);
  text-decoration: underline;
}

.maja-widget-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
}

.maja-widget-typing-dots span {
  width: 0.36rem;
  height: 0.36rem;
  border-radius: 999px;
  background: #8093aa;
  animation: majaWidgetTyping 1.2s infinite ease-in-out;
}

.maja-widget-typing-dots span:nth-child(2) {
  animation-delay: 0.16s;
}

.maja-widget-typing-dots span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes majaWidgetTyping {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-1.8px);
    opacity: 1;
  }
}

.maja-widget-quick {
  border-top: 1px solid rgba(219, 228, 239, 0.85);
  padding: 0.62rem 0.75rem 0.72rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  background: #f7faff;
}

.maja-widget-quick.is-hidden {
  display: none;
}

.maja-widget-quick-btn {
  border: 1px solid rgba(128, 101, 146, 0.26);
  background: #ffffff;
  color: var(--maja-widget-primary-hover);
  border-radius: 999px;
  padding: 0.32rem 0.58rem;
  font-size: 0.76rem;
  line-height: 1.2;
  cursor: pointer;
}

.maja-widget-quick-btn:hover {
  background: var(--maja-widget-primary-soft);
}

.maja-widget-footer {
  padding: 0.62rem 0.78rem 0.72rem;
  background: #fff;
  border-top: 1px solid var(--maja-widget-border);
}

.maja-widget-error {
  font-size: 0.78rem;
  border: 1px solid #f5c2c7;
  background: #fdecef;
  color: #9f1636;
  border-radius: 0.6rem;
  padding: 0.4rem 0.52rem;
  margin-bottom: 0.52rem;
}

.maja-widget-error.d-none {
  display: none;
}

.maja-widget-form {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
}

.maja-widget-input {
  flex: 1 1 auto;
  resize: none;
  border: 1px solid rgba(128, 101, 146, 0.28);
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.35;
  padding: 0.55rem 0.68rem;
  min-height: 41px;
  max-height: 110px;
  color: var(--maja-widget-text);
}

.maja-widget-input:focus {
  outline: 3px solid var(--maja-widget-primary-soft);
  border-color: var(--maja-widget-primary);
}

.maja-widget-send {
  border: 0;
  border-radius: 12px;
  background: var(--maja-widget-primary);
  color: #fff;
  min-height: 41px;
  padding: 0.5rem 0.84rem;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.maja-widget-send:hover {
  background: var(--maja-widget-primary-hover);
}

.maja-widget-send:disabled,
.maja-widget-input:disabled {
  cursor: not-allowed;
  opacity: 0.75;
}

.maja-widget-footnote {
  margin-top: 0.52rem;
  color: var(--maja-widget-muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

.maja-widget-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 576px) {
  .maja-widget-root {
    right: 12px;
    bottom: 12px;
  }

  .maja-widget-window {
    right: 0;
    bottom: 68px;
    width: calc(100vw - 24px);
    height: min(82vh, 680px);
    border-radius: 18px;
  }

  .maja-widget-fab {
    min-height: 52px;
    min-width: 52px;
    padding: 0.72rem;
  }

  .maja-widget-fab-label {
    display: none;
  }

  .maja-widget-message-bubble {
    max-width: 92%;
  }

  .maja-widget-root.maja-widget-root-embedded {
    right: auto;
    bottom: auto;
  }

  .maja-widget-root.maja-widget-root-embedded .maja-widget-window {
    width: 100%;
    height: min(72vh, 680px);
    min-height: 460px;
    right: auto;
    bottom: auto;
  }
}
