#ej-agent,
#ej-agent * {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

#ej-agent * {
  margin: 0;
}

#ej-launcher {
  position: fixed;
  bottom: max(22px, env(safe-area-inset-bottom, 0px) + 16px);
  right: max(22px, env(safe-area-inset-right, 0px) + 16px);
  z-index: 99998;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0a2a3a;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(10, 42, 58, 0.35);
  transition: transform 0.15s;
  max-width: calc(100vw - 32px);
}

#ej-launcher:hover {
  transform: scale(1.04);
}

#ej-launcher .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #1dbbdf;
  box-shadow: 0 0 0 0 rgba(29, 187, 223, 0.6);
  animation: ejpulse 1.8s infinite;
  flex-shrink: 0;
}

@keyframes ejpulse {
  0% { box-shadow: 0 0 0 0 rgba(29, 187, 223, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(29, 187, 223, 0); }
  100% { box-shadow: 0 0 0 0 rgba(29, 187, 223, 0); }
}

#ej-panel {
  position: fixed;
  bottom: 90px;
  right: 22px;
  z-index: 99999;
  width: 372px;
  max-width: calc(100vw - 32px);
  height: min(560px, calc(100dvh - 120px));
  max-height: calc(100dvh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(10, 42, 58, 0.28);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

#ej-panel.open {
  display: flex;
}

#ej-head {
  flex: 0 0 auto;
  background: linear-gradient(135deg, #0a2a3a, #12657e);
  color: #fff;
  padding: 16px 20px 12px;
}

#ej-head .row {
  display: flex;
  align-items: center;
  gap: 12px;
}

#ej-head .avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #1dbbdf;
  color: #0a2a3a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

#ej-head .t {
  font-size: 15px;
  font-weight: 700;
}

#ej-head .s {
  font-size: 12px;
  opacity: 0.85;
}

#ej-head button {
  margin-left: auto;
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.8;
  padding: 4px 8px;
  min-width: 36px;
  min-height: 36px;
}

#ej-head .note {
  font-size: 10.5px;
  opacity: 0.75;
  margin-top: 8px;
  line-height: 1.45;
}

#ej-msgs-shell {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  background: #f2f7f9;
}

#ej-msgs {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 18px 18px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

#ej-agent .ej-m {
  max-width: 92%;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-line;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#ej-agent .ej-m a {
  color: #12657e;
  font-weight: 600;
}

#ej-agent .ej-bot {
  background: #fff;
  border: 1px solid #dfe9ee;
  color: #22303f;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

#ej-agent .ej-user {
  background: #0a2a3a;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

#ej-agent .ej-chips {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: stretch;
  width: 100%;
  padding: 2px 0 8px;
}

#ej-agent .ej-chip {
  background: #fff;
  border: 1.5px solid #12657e;
  color: #12657e;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.12s;
  min-height: 44px;
  line-height: 1.35;
  text-align: left;
  width: 100%;
}

#ej-agent .ej-chip:hover {
  background: #12657e;
  color: #fff;
}

#ej-agent .ej-cta {
  display: inline-block;
  background: #1dbbdf;
  color: #0a2a3a !important;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 999px;
  margin-top: 10px;
  margin-right: 6px;
}

#ej-compose {
  flex: 0 0 auto;
  background: #fff;
  border-top: 1px solid #dfe9ee;
  box-shadow: 0 -6px 20px rgba(10, 42, 58, 0.08);
}

#ej-ticket-form {
  display: none;
  padding: 14px 18px 4px;
  background: #fff;
}

#ej-ticket-form.visible {
  display: block;
}

#ej-ticket-form .ej-ticket-title {
  font-size: 15px;
  font-weight: 700;
  color: #0a2a3a;
  margin-bottom: 4px;
}

#ej-ticket-form .ej-ticket-sub {
  font-size: 12px;
  line-height: 1.45;
  color: #5a7184;
  margin-bottom: 12px;
}

#ej-ticket-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #12657e;
  margin: 0 0 6px;
}

#ej-ticket-form input,
#ej-ticket-form textarea {
  width: 100%;
  display: block;
  border: 1.5px solid #d5e2e9;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 16px;
  line-height: 1.4;
  outline: none;
  background: #fff;
  color: #0a2a3a;
  margin-bottom: 12px;
  -webkit-appearance: none;
  appearance: none;
}

#ej-ticket-form textarea {
  min-height: 72px;
  resize: vertical;
}

#ej-ticket-form input:focus,
#ej-ticket-form textarea:focus {
  border-color: #12657e;
  box-shadow: 0 0 0 3px rgba(18, 101, 126, 0.12);
}

#ej-ticket-form .ej-ticket-error {
  min-height: 0;
  font-size: 12px;
  line-height: 1.4;
  color: #b42318;
  margin: -4px 0 10px;
}

#ej-ticket-form .ej-ticket-error:not(:empty) {
  min-height: 1.4em;
}

#ej-ticket-form .ej-ticket-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 4px;
}

#ej-ticket-form .ej-ticket-secondary,
#ej-ticket-form .ej-ticket-primary {
  flex: 1 1 0;
  min-height: 44px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

#ej-ticket-form .ej-ticket-secondary {
  background: #eef4f7;
  color: #12657e;
}

#ej-ticket-form .ej-ticket-primary {
  background: #0a2a3a;
  color: #fff;
}

#ej-inputrow.hidden {
  display: none !important;
}

#ej-inputrow {
  display: flex !important;
  gap: 10px;
  padding: 12px 18px;
  background: #fff;
  align-items: center;
  visibility: visible !important;
  opacity: 1 !important;
}

#ej-agent #ej-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  border: 1.5px solid #d5e2e9;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 16px;
  line-height: 1.4;
  outline: none;
  background: #fff !important;
  color: #0a2a3a !important;
  min-height: 46px;
  -webkit-appearance: none;
  appearance: none;
}

#ej-agent #ej-input:focus {
  border-color: #12657e;
  box-shadow: 0 0 0 3px rgba(18, 101, 126, 0.12);
}

#ej-send {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a2a3a;
  color: #fff;
  border: none;
  border-radius: 999px;
  width: 46px;
  height: 46px;
  font-size: 16px;
  cursor: pointer;
}

#ej-agent .ej-typing {
  display: flex;
  gap: 4px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #dfe9ee;
  border-radius: 14px;
  align-self: flex-start;
}

#ej-agent .ej-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9db8c4;
  animation: ejb 1.2s infinite;
}

#ej-agent .ej-typing i:nth-child(2) {
  animation-delay: 0.15s;
}

#ej-agent .ej-typing i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes ejb {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

#ej-foot {
  flex: 0 0 auto;
  text-align: center;
  font-size: 10.5px;
  padding: 0 18px 10px;
  background: #fff;
  color: #8a9bb0;
}

#ej-foot a {
  color: #12657e;
  text-decoration: none;
  font-weight: 600;
}

@media (max-width: 480px) {
  #ej-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: min(92dvh, calc(100dvh - 8px));
    max-height: 92dvh;
    border-radius: 16px 16px 0 0;
  }

  #ej-head {
    padding: 16px 16px 12px;
  }

  #ej-msgs {
    padding: 16px 16px 24px;
  }

  #ej-inputrow {
    padding: 12px 16px max(12px, env(safe-area-inset-bottom, 0px) + 8px);
  }

  #ej-ticket-form {
    padding: 14px 16px 4px;
    padding-bottom: max(4px, env(safe-area-inset-bottom, 0px));
  }

  #ej-foot {
    padding: 0 16px max(8px, env(safe-area-inset-bottom, 0px) + 4px);
  }

  #ej-launcher {
    bottom: max(16px, env(safe-area-inset-bottom, 0px) + 12px);
    right: max(16px, env(safe-area-inset-right, 0px) + 12px);
    padding: 12px 18px;
    font-size: 14px;
  }
}
