#itemdd-webchat-root {
  position: fixed;
  z-index: 99998;
  bottom: 20px;
  right: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Thai", sans-serif;
  font-size: 14px;
  color: #1f2937;
  line-height: 1.5;
}

#itemdd-webchat-root #ic-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#itemdd-webchat-root #ic-toggle:hover { transform: scale(1.05); box-shadow: 0 6px 20px rgba(0,0,0,0.25); }
#itemdd-webchat-root #ic-toggle:focus { outline: 2px solid #fff; outline-offset: 2px; }

#itemdd-webchat-root #ic-panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#itemdd-webchat-root #ic-header {
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}
#itemdd-webchat-root #ic-title { font-size: 15px; }
#itemdd-webchat-root #ic-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.85;
}
#itemdd-webchat-root #ic-close:hover { opacity: 1; }

#itemdd-webchat-root #ic-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#itemdd-webchat-root .ic-greeting {
  background: #fff;
  border: 1px solid #e5e7eb;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  color: #374151;
  line-height: 1.55;
}

#itemdd-webchat-root .ic-msg {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.5;
  word-wrap: break-word;
}
#itemdd-webchat-root .ic-msg-customer {
  align-self: flex-end;
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 2px;
}
#itemdd-webchat-root .ic-msg-staff {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #1f2937;
  border-bottom-left-radius: 2px;
}
#itemdd-webchat-root .ic-msg-meta {
  font-size: 10.5px;
  opacity: 0.7;
  margin-bottom: 3px;
}
#itemdd-webchat-root .ic-msg-body { white-space: pre-wrap; }

#itemdd-webchat-root #ic-form,
#itemdd-webchat-root #ic-input {
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
}
#itemdd-webchat-root .ic-form-row { margin-bottom: 8px; }
#itemdd-webchat-root .ic-form-row label {
  display: block;
  font-size: 12px;
  color: #4b5563;
  margin-bottom: 3px;
  font-weight: 500;
}
#itemdd-webchat-root .ic-form-row input,
#itemdd-webchat-root #ic-msg {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 13.5px;
  font-family: inherit;
  color: #1f2937;
}
#itemdd-webchat-root .ic-form-row input:focus,
#itemdd-webchat-root #ic-msg:focus {
  outline: 2px solid #93c5fd;
  outline-offset: -1px;
  border-color: #3b82f6;
}
#itemdd-webchat-root .ic-form-note {
  font-size: 11px;
  color: #6b7280;
  margin: 6px 0 10px;
  line-height: 1.45;
}
#itemdd-webchat-root .ic-form-note a { color: #2563eb; }

#itemdd-webchat-root .ic-btn {
  border: none;
  color: #fff;
  padding: 9px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  width: 100%;
  transition: opacity 0.15s;
}
#itemdd-webchat-root .ic-btn:hover { opacity: 0.92; }
#itemdd-webchat-root .ic-btn:disabled { opacity: 0.6; cursor: not-allowed; }

#itemdd-webchat-root #ic-input {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#itemdd-webchat-root #ic-input textarea {
  resize: none;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 13.5px;
  font-family: inherit;
}
#itemdd-webchat-root #ic-send { width: 100%; }

#itemdd-webchat-root #ic-footer {
  padding: 6px 12px;
  background: #f3f4f6;
  border-top: 1px solid #e5e7eb;
  font-size: 11px;
  color: #6b7280;
  text-align: center;
}

@media (max-width: 480px) {
  #itemdd-webchat-root #ic-panel {
    width: calc(100vw - 32px);
    height: calc(100vh - 100px);
    bottom: 72px;
  }
}
